// 1002.cpp : Defines the entry point for the console application.
//
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
using namespace std;

#define MAX_COUNT 1000

struct Elephant
{
	int weight;
	int iq;
	int pos;

	bool compare_by_iq( const Elephant& e ) const 
	{
		return e.iq < this->iq;
	}

	bool compare_by_weight( const Elephant& e ) const 
	{
		return ( this->weight < e.weight ) && ( this->iq != e.iq );
	}
};


template< typename _InIt, typename _Pr, typename _Fn1 >
void LIS( _InIt begin, _InIt end, _Pr pr, _Fn1 f )
{
	struct LISN
	{
		int prev;
		int length;

		LISN()
		{
			prev = -1;
			length = 1;
		}
	};

	LISN nodes[ MAX_COUNT ];

	int maxpos = 0;

	for( int i = 1; i < end - begin; i++ )
	{
		int pos = -1;
		for( int k = 0; k < i; k++ )
		{
			if( pr( *(begin + k), *(begin + i) ) )
			{
				if( pos == -1 || nodes[pos].length < nodes[k].length )
				{
					pos = k;
				}
			}
		}

		if( pos != -1 )
		{
			nodes[i].prev = pos;
			nodes[i].length = nodes[pos].length + 1;
		}

		if( nodes[maxpos].length < nodes[i].length )
		{
			maxpos = i;
		}
	}

	int rlist[ MAX_COUNT ] = { 0 };

	int j = 0;
	for( int i = maxpos; i != -1; i = nodes[i].prev )
	{
		rlist[j++] = i;
	}

	f( begin, rlist, j );
}

void print_ans( Elephant* begin, int* rlist, int count )
{
	cout << count << endl;
	for( int i = count - 1; i >= 0 ; i-- )
	{
		cout <<  begin[ rlist[i] ].pos << endl;
	}

}

int main( int agrc, char* argv[] )
{
	Elephant R[ MAX_COUNT ];

	int elephant_count = 0;
	while( cin >> R[ elephant_count ].weight >> R[ elephant_count ].iq )
	{
		R[ elephant_count ].pos = elephant_count + 1;
		elephant_count++;
	}

	std::sort( R, R + elephant_count, mem_fun_ref( &Elephant::compare_by_iq ) );
	LIS( R, R + elephant_count, mem_fun_ref( &Elephant::compare_by_weight ), print_ans );

	return 0;
}
